Plot things

We will create a dummy tracer as a function of location to showcase each plot, just for the sake of the examples herein.

This guide is organized as follows

In this guide we will focus on how-to plot things using AIBECS' built-in recipes for Plots.jl. These recipes are implemented using [RecipesBase.jl]https://github.com/JuliaPlots/RecipesBase.jl(), which are explained in Plots.jl's documentation.

Throughout we will use the OCIM1 grid.

using AIBECS, Plots
grd, _ = OCIM1.load()
(, 
  [1     ,      1]  =  0.000197784
  [2     ,      1]  =  1.05541e-8
  [10384 ,      1]  =  -2.09257e-7
  [10442 ,      1]  =  -0.000191611
  [10443 ,      1]  =  4.80961e-9
  [20825 ,      1]  =  -1.83059e-9
  [20883 ,      1]  =  7.967e-9
  [1     ,      2]  =  -5.98052e-8
  [2     ,      2]  =  0.000187532
  ⋮
  [200160, 200159]  =  -2.04829e-8
  [197886, 200160]  =  2.41231e-9
  [199766, 200160]  =  6.70985e-9
  [199777, 200160]  =  -1.26357e-9
  [199778, 200160]  =  -7.22216e-9
  [199779, 200160]  =  7.59325e-9
  [199790, 200160]  =  -7.41023e-9
  [200156, 200160]  =  -3.07748e-8
  [200159, 200160]  =  -2.14741e-8
  [200160, 200160]  =  5.22074e-8)

Horizontal plots

Horizontal slice

The most common thing you plot after a simulation of marine tracers is a horizontal slice. In this case, you just need to provide the tracer (dummy here), the grid object grd, and the depth at which you want to plot.

iwet = findall(vec(iswet(grd)))
dummy = cos.(ustrip.(upreferred.(grd.lat_3D[iwet])))
horizontalslice(dummy, grd, 10)
50 100 150 200 250 300 350 -60 -30 0 30 60 Longitude Latitude 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

You can supply units for the depth at which you want to see the horizontal slice.

horizontalslice(dummy, grd, 10u"m")
50 100 150 200 250 300 350 -60 -30 0 30 60 Longitude Latitude 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

And the units should be understood under the hood.

horizontalslice(dummy, grd, 3u"km")
50 100 150 200 250 300 350 -60 -30 0 30 60 Longitude Latitude 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

If your tracer is supplied with units, those will show in the colorbar label

horizontalslice(dummy * u"mol/m^3", grd, 10u"m")
50 100 150 200 250 300 350 -60 -30 0 30 60 Longitude Latitude 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 mol m^-3

The advantage of Plots.jl recipes like this one is that you can specify other pieces of the plot as you would with built-in functions. The advantage of Plots.jl recipes like this one is that you can specify other pieces of the plot as you would with built-in functions. For example, you can chose the colormap

dummy .= cos.(ustrip.(upreferred.(grd.lon_3D[iwet]))) .* dummy
horizontalslice(dummy, grd, 100, color=:magma)
50 100 150 200 250 300 350 -60 -30 0 30 60 Longitude Latitude - 0.75 - 0.50 - 0.25 0 0.25 0.50 0.75

Or you can change predefine bits after the fact.

plt = horizontalslice(dummy, grd, 100, color=:magma)
plot!(plt, xlabel="Lon", ylabel="Lat", colorbar_title="No units", title="The pacific as a whole")
50 100 150 200 250 300 350 -60 -30 0 30 60 The pacific as a whole Lon Lat - 0.75 - 0.50 - 0.25 0 0.25 0.50 0.75 No units

Vertical plots

Exploring the vertical distribution of tracers is important after all.

Zonal slices

You must specify the longitude

dummy .+= sqrt.(ustrip.(grd.depth_3D[iwet])) / 30
zonalslice(dummy, grd, 330)
-60 -30 0 30 60 18 55 94 137 187 247 317 401 501 619 758 919 1104 1317 1559 1833 2141 2485 2867 3290 3756 4267 4825 5433 Latitude Depth (m) 0.5 1.0 1.5 2.0 2.5 3.0

Zonal averages

Global zonal average

zonalaverage(dummy, grd)
-60 -30 0 30 60 18 55 94 137 187 247 317 401 501 619 758 919 1104 1317 1559 1833 2141 2485 2867 3290 3756 4267 4825 5433 Latitude Depth (m) 0 0.5 1.0 1.5 2.0 2.5

Basin zonal average

(not available yet)

Meridional slices

(not available yet)

Meridional averages

(not available yet... at all?)

Zonal transect

(Not available yet... Thanks to GEOTRACES DMC)

Meridional transect

(Not available yet... Thanks to GEOTRACES DMC)

Depth profiles

interpolateddepthprofile(dummy, grd, 0, 330)
1.0 1.5 2.0 2.5 18 55 94 137 187 247 317 401 501 619 758 919 1104 1317 1559 1833 2141 2485 2867 3290 3756 4267 4825 5433 y1

Non geographic plots


This page was generated using Literate.jl.